package com.liuqi.knet.remoting.exchange.support;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * @author liuqi
 * @date 2025/2/8 17:45
 * @see com.liuqi.knet.remoting.exchange.codec.ExchangeCountCodec
 **/
public class MultiMessage implements Iterable {

    private final LinkedList messages = new LinkedList();

    public void addMessage(Object msg) {
        messages.add(msg);
    }

    public int size() {
        return messages.size();
    }

    public Object getFirst() {
        return messages.getFirst();
    }

    public Object get(int index) {
        return messages.get(index);
    }

    public boolean isEmpty() {
        return messages.isEmpty();
    }

    @Override
    public Iterator iterator() {
        return messages.iterator();
    }
}
